<?php

namespace App\Console\Commands;

use App\Common\Utils\EasyWechat;
use Illuminate\Console\Command;

class EditOfficialAccountMenu extends Command
{
    /**
     * 命令名称及签名
     *
     * @var string
     */
    protected $signature = 'utils:edit_official_account_menu';

    /**
     * 命令描述
     *
     * @var string
     */
    protected $description = '更新微信公众号菜单';

    public function handle()
    {
        $application = EasyWechat::getOfficialAccount();
        $application->menu->create([
            [
                'type' => 'click',
                'name' => '文案收到',
                'key' => 'copywriting_received'
            ],
            [
                'name' => '系统查询',
                'sub_button' => [
                    [
                        'type' => 'view',
                        'name' => '商城入口',
                        'url' => 'https://www.ssddjj.com'
                    ],
                    [
                        'type' => 'view',
                        'name' => '历史订单',
                        'url' => 'https://sdj.ssddjj.com/sdj.open/m/index.html#/myOrder'
                    ]
                ]
            ],
            [
                'name' => '管理中心',
                'sub_button' => [
                    [
                        'type' => 'click',
                        'name' => '平台介绍',
                        'key' => 'platform_introduction'
                    ],
                    [
                        'type' => 'click',
                        'name' => '新人起步',
                        'key' => 'newcomer_start'
                    ],
                    [
                        'type' => 'click',
                        'name' => '进素材群',
                        'key' => 'into_the_material_group'
                    ],
//                    [
//                        'type' => 'click',
//                        'name' => '运营须知',
//                        'key' => 'operation_notice'
//                    ],
//                    [
//                        'type' => 'click',
//                        'name' => '运营素材',
//                        'key' => 'operating_material'
//                    ],
                ]
            ]
        ]);
    }
}
